package com.example.api.model.entity;

import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * 验证码
 */
@Data
@Entity
@NoArgsConstructor
public class Code {

    @Id
    private String email;

    private String value;

    private long exp;


    public Code(String email, String value) {
        this.email = email;
        this.value = value;
        this.exp = System.currentTimeMillis() + 1000 * 60 * 15;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public long getExp() {
        return exp;
    }

    public void setExp(long exp) {
        this.exp = exp;
    }
}
